/**
 * @typedef TutorialDetailDto
 * @property {string} chapterUuid -教程章节id
 */

/**
 * @typedef TutorialList
 * @property {string} categoryId.required -教程所属分类id
 */

const express = require('express')
const router = express.Router()
const tutorialController = require('@/controllers/tutorial.controller')

/**
 * 查询教程分类
 * @route GET /tutorial/category
 * @group 教程管理
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 */
router.get('/category', tutorialController.getTutorialCategory)

/**
 * 查询教程列表
 * @route GET /tutorial/list
 * @group 教程管理
 * @param {TutorialList.model} tutorialDetailDto.body.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 */
router.post('/list', tutorialController.getTutorialList)

/**
 * 查询教程详情
 * @route POST /tutorial/detail
 * @group 教程管理
 * @param {TutorialDetailDto.model} tutorialDetailDto.body.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 */
router.post('/detail', tutorialController.getTutorialDetail)

/**
 * 查询教程文章详情
 * @route POST /tutorial/chapter-detail
 * @group 教程管理
 * @param {TutorialDetailDto.model} tutorialDetailDto.body.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 */
router.post('/chapter-detail', tutorialController.getTutorialChapterInfo)

/**
 * 查询教程评论
 * @route POST /tutorial/comments
 * @group 教程管理
 * @param {TutorialDetailDto.model} tutorialDetailDto.body.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 */
router.post('/comments', tutorialController.getTutorialChapterComment)

module.exports = router
